#include <stdio.h>

enum rule{
	stone=0,cloth,scissors
};

enum result{
	fail=-1,draw,win
};

enum result compare(enum rule a,enum rule b){
	if(a==stone)
	{
		if(b==stone)
		return draw;
		else if(b==cloth)
		return fail;
		else
		return win;
	}
	if(a==cloth)
	{
		if(b==stone)
		return win;
		else if(b==cloth)
		return draw;
		else
		return fail;
	}
	if(a==scissors)
	{
		if(b==stone)
		return fail;
		else if(b==cloth)
		return win;
		else
		return draw;
	}
}

int main()
{
	int input_a;
	enum rule a;
	int input_b;
	enum rule b;
	while(1)
	{
		scanf("%d %d",&input_a,&input_b);
		a=(enum rule)input_a;
		b=(enum rule)input_b;
		if((a>=0 && a<=2) && (b>=0 && b<=2))
		break;
		else
		printf("输入错误请重新输入");
	}
	printf("%d",compare(a,b));
	return 0;
}